#!/usr/bin/env python
# -*- encoding: utf-8 -*-
import logging
from wxpy import *
import components.wow_remote_commander as wowremote
import components.wow_order as woworder
import re
import time
from components.wow_announce import Announce
import components.mojo_qq as mojo_qq

logging.basicConfig(level=20, format='%(asctime)s [%(module)s] %(levelname)-8s %(message)s',
                        datefmt='%Y-%m-%d %H:%M:%S')


if __name__ == '__main__':
    announce = Announce("180.97.187.89", "test", "1z2x3c4v", "auth")
    qq = mojo_qq.MoJoQQ(mojo_host='180.97.187.89', mojo_port='5000')

    while True:
        row = announce.find_newest_announce()
        if row:
            logging.info("New Announce %s" % row[1])
            qq.send_group_msg('657768313', row[1])
            announce.set_synced(row[0])
        time.sleep(1)

    announce.close()